package de.jmda.gen.impl;

import static java.lang.System.lineSeparator;
import static org.junit.Assert.assertTrue;

import org.apache.log4j.Logger;
import org.junit.Test;

import de.jmda.gen.GeneratorException;
import de.jmda.gen.java.impl.DefaultPackageInfoGenerator;

public class JUTDefaultCompilationUnitPackageGenerator
{
	private final static Logger LOGGER =
      Logger.getLogger(JUTDefaultCompilationUnitPackageGenerator.class);

	@Test
	public void testDefaultCompilationUnitPackageGenerator() throws GeneratorException
	{
		String packagename = "package.name";
		String javadoc = "javadoc";

		DefaultPackageInfoGenerator generator =
				new DefaultPackageInfoGenerator(packagename, javadoc);

		StringBuffer generated = generator.generate();
		
		LOGGER.debug("generated [" + generated + "]");

		assertTrue(
				"unexpected generated [" + generated + "]",
				(
						"/**" + lineSeparator() +
						" * " + javadoc + lineSeparator() +
						" */" + lineSeparator() +
						"package " + packagename + ";"
				).contentEquals(generated));
	}
}